// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import '../node_modules/element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

//设置访问根路径
axios.defaults.baseURL = "http://120.79.19.249:8085"   //正式部署之前要记得将这句话删掉。
//设置请求拦截器
 axios.interceptors.request.use(config => {
	//发送请求就开启进度条
	NProgress.start()
	//塞入token
	config.headers.Authorization=window.sessionStorage.getItem('token');
	return config
})
//设置响应拦截器
axios.interceptors.response.use(config =>{
	//得到响应就隐藏进度条
	NProgress.done()
	return config
}) 

//挂载axios
Vue.prototype.$http = axios
Vue.prototype.HOST = '/api'
// axios.defaults.withCredentials = true;
// Vue.config.productionTip = false
Vue.use(ElementUI)	
// /* eslint-disable no-new */
// Vue.prototype.$http = axios

new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})